<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            position: relative;
            margin: 100px auto;
            width: 200px;
            color: #333;
            font-size: 14px;
        }
        
        .code {
            background-color: red;
            width: 100px;
            height: 120px;
        }
        
        .close-btn {
            position: absolute;
            top: 20px;
            left: -16px;
            width: 14px;
            height: 16px;
            line-height: 16px;
            font-family: Arial, Helvetica, sans-serif;
            border: 1px solid #ccc;
            cursor: pointer;
            font-size: 16px;
        }
    </style>
</head>

<body>
    <div class="box">
        淘宝二维码
        <div class="code"></div>
        <i class="close-btn">×</i>
    </div>
    <script>
        var btn = document.querySelector('.close-btn');
        var box = document.querySelector('.box');
        btn.onclick = function() {
            // 隐藏
            box.style.display = 'none';
        }
    </script>
</body>

</html>